package com.antler.smt.admin.controller;

import com.antler.smt.admin.annotation.OperateCut;
import com.antler.smt.enums.ResultCodeEnum;
import com.antler.smt.response.admin.GetProposalListResp;
import com.antler.smt.response.base.Result;
import com.antler.smt.service.admin.OrderCommentService;
import com.antler.smt.utils.LogUtil;
import com.antler.smt.validate.DataValidator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 *  后台订单评价控制接口
 *
 * @author zhangyi
 * @date 2018/4/18 9:44
 */
@RestController
@RequestMapping("/orderCommentBack")
@Api(description = "后台订单评价控制接口")
public class OrderCommentController {

    /**
     * 日志
     */
    private static Logger log = LogUtil.get();


    @Resource
    private OrderCommentService orderCommentService;

    /**
     * 向首页展示
     *
     * @param id 订单id
     * @return Result实体
     */
    @PostMapping("/goHomePageShow")
    @ApiOperation(value = "向首页展示订单评价信息", httpMethod = "POST")
    @OperateCut(content = "向首页展示订单评价信息")
    public Result<ResultCodeEnum> goHomePageShow(@RequestParam(value = "id") Long id) {

        DataValidator.isBlank(String.valueOf(id),"订单评价id必传！");

        Result result = null;
            result = orderCommentService.OrderCommentHomePage(id);
        return result;
    }
    /**
     * 向服务商展示
     *
     * @param id 订单id
     * @return Result实体
     */
    @PostMapping("/goSupplierShow")
    @ApiOperation(value = "向服务商展示订单评价信息", httpMethod = "POST")
    @OperateCut(content = "向服务商展示订单评价信息")
    public Result<ResultCodeEnum> goSupplierShow(@RequestParam(value = "id") Long id) {

        DataValidator.isBlank(String.valueOf(id),"订单评价id必传！");

        Result result = null;
            result = orderCommentService.OrderCommentSupplier(id);
        return result;
    }

}
